const initialState = {
  list: [],
  current: 0,
};

export default function channelReducer(
  state = initialState,
  { type, payload }
) {
  switch (type) {
    // 5.保存list的逻辑
    case 'channel/setList':
      return {
        ...state,
        list: [...payload],
      };
    // 3.1 编写更新逻辑
    case 'channel/setCurrent':
      return {
        ...state,
        current: payload,
      };
    default:
      return state;
  }
}
